import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class code1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int q = in.nextInt();
        for(int i=0;i<q;i++) {
            int a = in.nextInt();
            int b = in.nextInt();
            int c = in.nextInt();
            tanxin(a,b,c);
        }
    }
    public static void tanxin(int a,int b,int c) {
        int ret = 0;
        int x = Math.min(a,Math.min(b,c));
        ret += 2*x;
        if(b-x>=2) {
            ret += (b-x-1);
        }
        System.out.println(ret);
    }
}